package com.thjk.bdf.common.utils;

import com.thjk.bdf.common.base.BasicResp;
import com.thjk.bdf.common.enmus.AdmissionEnum;

public class RespUtils {

    public static final BasicResp BASIC_ERROR_RESP = new BasicResp(AdmissionEnum.Error_SYS_Code.getCode(),
            AdmissionEnum.Error_SYS_Code.getOuterDesc());

    public static BasicResp buildFromAdmissionEnum(AdmissionEnum admissionEnum) {
        if (admissionEnum == null) {
            return BASIC_ERROR_RESP;
        }

        BasicResp resp = new BasicResp();
        resp.setCode(admissionEnum.getCode());
        resp.setMessage(admissionEnum.getOuterDesc());
        return resp;
    }
}
